﻿using System;

namespace csharpbiancheng_ch11_example4
{
    class Program
    {
        //定义购买商品委托
        public delegate void OrderDelegate();
        static void Main(string[] args)
        {
            OrderDelegate orderDeletge = new OrderDelegate(Order.BuyFood);
            //向委托中注册方法
            orderDeletge += Order.BuyCake;
            orderDeletge += Order.BuyFlower;
            //跳用委托
            orderDeletge();
        }
    }

    class Order
    {
        public static void BuyFood()
        {
            Console.WriteLine("购买快餐!");
        }

        public static void BuyCake()
        {
            Console.WriteLine("购买蛋糕!");
        }

        public static void BuyFlower()
        {
            Console.WriteLine("购买鲜花!");
        }
    }
}
